<?php
/**
 *
 * @Filename index.php $
 *
 * @Author nikm $
 *
 * @Date 2011-12-19 $
 */

//error_reporting(E_ERROR);
error_reporting(E_ALL|E_NOTICE);
ini_set('display_errors', 'on');

define('FROM_INDEX', true);
define('ROOT_PATH', substr(dirname(__FILE__), 0, -8) . '/');

require ROOT_PATH.'include/lib/load_setting.php';
load_setting('site_setting');
@header('Content-Type: text/html; charset='.CHARSET);

load_setting('config_servlet');
require ROOT_PATH.'include/function/global.func.php';
require ROOT_PATH.'include/lib/cache.func.php';
require ROOT_PATH.'servlet/include/function/servlet.func.php';

//$request = $_POST;
$request = $_REQUEST;

$request['start_time'] = microtime(true);

//Request is invalid
if(!validate_request($_POST)) show_msg($request, 'g_01', STATUS_E);

// Available modules
$mods = array('business'=>1, 'seafood'=>1, 'comment'=>1, 'complaint'=>1, 
			'customer'=>1, 'hostel'=>1, 'scenic'=>1, 'shop'=>1,
			'credit_list'=>1, 'gov_price'=>1, 'complaint_deal'=>1, 'news'=>1);

$mod = isset($request['m']) ? $request['m'] : '';
$act = isset($request['a']) ? $request['a'] : '';

$mod_file = ROOT_PATH.'servlet/module/'.$mod.'.mod.php';
// Module does not exists
if(!isset($mods[$mod]) || !$mods[$mod] || !file_exists($mod_file))
{
	show_msg($request, 'g_03', STATUS_E);
}

require_once $mod_file;
$module = new moduleObj($request);